package com.zxy;

import java.util.ArrayList;
import java.util.LinkedList;

public class LinkedListDemo {

    public static void main(String[] args) {

       LinkedList<String> list = new LinkedList<>();


       list.addFirst("张三");
       list.addFirst("李四");
       list.addFirst("王五");
       list.addFirst("赵六");
       list.addFirst("钱七");

       String s = list.get(3);
        ArrayList<String>arrayList = new ArrayList<>();
        arrayList.add(s);

       String first = list.getFirst();
       System.out.println(first);
       String last = list.getLast();
       System.out.println(last);

        String removeFirst = list.removeFirst();
        System.out.println(removeFirst);
        String removeLast = list.removeLast();
        System.out.println(removeLast);


        System.out.println(list);

    }
}
